package com.woniuxy.automotivemanagementsystem.utils;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@ResponseBody
public class MyExceptionAdvice {
    @ExceptionHandler(Exception.class)
    public Result handleException(Exception e)
    {
        e.printStackTrace();
        return new Result(555,false,e.getMessage(),null);
    }
//    @ExceptionHandler(UserNameException.class)
//    public Result handleUserNameException(UserNameException e)
//        {
//            e.printStackTrace();
//            return new Result(500,false,e.getMessage(),null);
//        }
}
